<?php
/**
 * Created by PhpStorm.
 * Register: czm
 * Date: 2019-06-24
 * Time: 14:11
 */
namespace app\admin\controller;

use think\Controller;
use think\Db;

class Business extends Controller
{
    public function businessList()
    {
        return $this->fetch();
    }

    public function businessAdd()
    {
//        $list = Db::name('admin')->order('id desc')->select();
////        $this->assign('data',$list);
//        return json($list);
        $contact =Db('admin')->field('name,email')->select();
        if($contact)
        {
            $data = array('code'=>200,'msg'=>'success',$contact);
            return json_encode($data);
        }
        else
        {
            $data = ['code'=>400,'msg'=>'field'];
            return json_encode($data,TRUE);

        }
    }

    public function businessEdit()
    {
        return $this->fetch();
    }
}